#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
#include <signal.h>
#include <errno.h>

void signal_handler(int sig)
{
    printf("handler : sig = %d\n", sig);
}

int main(void)
{
    char buf[32] = {0};
    struct sigaction act = {0};
    
    act.sa_handler = signal_handler;
    act.sa_flags = SA_RESETHAND;
    
    sigaddset(&act.sa_mask, SIGINT);
    
    sigaction(SIGINT, &act, NULL);
    
    while (1) {
        pause();
    }

    return 0;
}

